<?php include './include/conf.php'; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">

<head>
		<title>Jardins familiaux de Lacroix-Falgarde : gestion des catégories </title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
		<link rel="stylesheet" type="text/css" href="style/style.css" />
		<script type="text/javascript" src="./script/fonctions_communes.js"></script>
		<script type="text/javascript" src="./script/gerer_categorie.js"></script>
</head>
	
<body>
	<div id="global">
		<!-- header -->
		<?php include './include/header.php' ; ?>
		
		<!-- fil d'ariane et espace adh�rant -->
		<p id="ariane">
			vous êtes ici : <a href="index.html">accueil</a> &gt; <a href="adherent.php">espace adhérent</a>  &gt; <a href="#">gérer catégories</a>
			<a id="espaceAdherent" href="connexion.php">espace adhérent</a>
		</p>	
		
		<!-- contenu -->
		<div id="contenu">
			<?php include('./include/menu_gauche.php');?>
			<div id="information">
			<h1>Gestion des catégories</h1>
			
			<?php
			$requete = $pdo->prepare("select * from categorie");
			$requete->execute(array(0));
			if ($requete->rowCount() != 0)
			{
			?>

				<table>
				<thead>
					<tr>
						<th id="catégories">Catégories</th>
						<th id="modifier">Modifier</th>
						<th id="supprimer">Supprimer</th>
				</thead>
				<tbody>
				<?php 
				$requete = $pdo->prepare("select * from categorie where nom <> 'Archive'  ");
				$requete->execute(array());
					while($categ = $requete->fetch())
					{
						echo "<tr>";
						echo "<td headers=".$categ->nom." id=".$categ->id_categorie.">".$categ->nom."</td>";
						echo "<td headers='image_modif'><a href='maj_categorie.php?id=".$categ->id_categorie."'><img src='./photos-site/maj.jpg' alt='logo mise � jour'/></a></td>";
						echo "<td headers='image_supprimer'><a href='del_categorie.php?id=".$categ->id_categorie."'><img src='./photos-site/supprimer.jpg' alt='logo supprimer'/></a></td>";
						echo "</tr>";
					}
					
					?>
					
				</tbody>
				</table>
			<?php 
			}
			?>
				
				<form id="ajout_info" method="post" action="add_categorie.php">
					<input type="text" name="categorie" id="new_categorie" />
					<input type="submit" name="bp_ajouter" id="bp_ajouter_cat" value="Ajouter catégorie"  />
				</form>
				<div id="mess_erreur"></div>
			</div>
		</div>

		<!-- footer -->
		<?php include('./include/footer.php'); ?>
	</div>
</body>
</html>